package com.epoint.action.activityinfo;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.epoint.bizlogic.activityinfo.ActivityInfoService;
import com.epoint.utils.RequestUtils;

/**
 * Servlet implementation class ActivityEditAction
 */
@WebServlet("/activityeditaction")
public class ActivityEditAction extends HttpServlet {
	private static final long serialVersionUID = 1L;
	ActivityInfoService activityInfoService = new ActivityInfoService();
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public ActivityEditAction() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
	    String requestMethod = request.getParameter("method");
        String json = RequestUtils.reflectInvokMethod(requestMethod, request, ActivityEditAction.class);
        response.getWriter().write(json);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}
	
	/**
	 * 删除活动信息
	 * @param request
	 * @return
	 */
	public String deleteActivityInfo(HttpServletRequest request) {
	    String activityId = request.getParameter("activityId");
	    int i = activityInfoService.deleteActivityInfo(activityId);
	    if (i > 0) {
	        return "删除成功";
	    } else {
	        return "删除失败";
	    }
	}

}
